<?php
	/**
	 * 连续登录奖励
	 */

	class LoginRewardList extends APIBase {
			
		public $tag = "LoginRewardList";
        public $isLogin = false;
		public function before() {
			$this->initMysql();
			return true;
		}

		public function logic() {

		   $result =  $this->mysql->find('select * from loginreward where 1=1');
		   $data = array();
		   $reward =array();
		   $i=0;
		   foreach($result as $row){
			   //if($row[''])
			 
			  if((int)$row['days']==1){
				 //unset($row['days']);
				 $reward1['day']=1;
				 $reward1['prop'][]=$row;
			
				 
		         }
				 
              if((int)$row['days']==2){
				 //unset($row['days']);
				 $reward2['day']=2;
				 $reward2['prop'][]=$row;
				 
		         }
			  if((int)$row['days']==3){
				 //unset($row['days']);
				 $reward3['day']=3;
				 $reward3['prop'][]=$row;
				 
		         }
				 
				 if((int)$row['days']==4){
				 //unset($row['days']);
				 $reward4['day']=4;
				 $reward4['prop'][]=$row;
				 
		         }
				 
				 if((int)$row['days']==5){
				 //unset($row['days']);
				 $reward5['day']=5;
				 $reward5['prop'][]=$row;
				 
		         }
				 
				 if((int)$row['days']==6){
				 //unset($row['days']);
				 $reward6['day']=6;
				 $reward6['prop'][]=$row;
				 
		         }
				 
				 if((int)$row['days']==7){
				 //unset($row['days']);
				 $reward7['day']=7;
				 $reward7['prop'][]=$row;
				 
		         } 
				 
				 
				 
		   }
		   
		   $reback[0] = $reward1;
		   $reback[1] = $reward2;
		   $reback[2] = $reward3;
		   $reback[3] = $reward4;
		   $reback[4] = $reward5;
		   $reback[5] = $reward6;
		   $reback[6] = $reward7;
           //$dd =  $data['days']
		   //$dd['days']=  $data;

		   $this->returnData(array('days'=>$reback));
		   
		   //$this->returnData($dd);

		}

		public function after() {
			$this->deinitMysql();
			//$this->deinitDataRedis();
		}
	}
?>
